{extend name="member/common/main"}

{block name="content"}

<link href="__STATIC__/home/css/vip_form.css" rel="stylesheet"/>

<script type="text/javascript" src="__STATIC__/plugs/layui/layui.js"></script>
<link href="__STATIC__/plugs/layui/css/layui.css" rel="stylesheet"/>

<style type="text/css">
  input[type=password]{
    -webkit-appearance: none;
    -moz-appearance: none;
    margin: 0;
    padding: 0;
    background: 0 0;
    border: none;
  }
  
  .login_input{
    height:184px;
  }
  .login_input_font{
    padding-top:10px;
  }
  .login_btn{
    padding-top:5px;
  }
  .login_input ul li{
    height:45px;
  }
</style>

<div class="vip_contentmain">
    <div class="vip_content">
      {include file="member/common/left" /}
      <form class="layui-form" action="" lay-filter="form">
      <div class="information Fright">
        <div class="information_title">密码修改</div>
        <div class="information_from Fleft">
        <div class="fromdiv">
          <div class="from_font Fleft">原密码：</div>
          <div class="from_info Fright">
            <div class="from_input">
              <input type="password" name="oldpassword" lay-verify="oldpassword" placeholder="请输入您的原密码"/>
            </div>
          </div>
        </div>
        <div class="fromdiv">
          <div class="from_font Fleft">新密码：</div>
          <div class="from_info Fright">
            <div class="from_input">
              <input type="password" name="password" lay-verify="password" placeholder="请输入您的新密码"/>
            </div>
          </div>
        </div>
        <div class="fromdiv">
          <div class="from_font Fleft">确认新密码：</div>
          <div class="from_info Fright">
            <div class="from_input">
              <input type="password" name="repassword" lay-verify="repassword" placeholder="请确认您的新密码"/>
            </div>
          </div>
        </div>
        <div class="from_btn">
          <input type="submit" id="subtn" lay-submit="" lay-filter="sub" value="提交" />
        </div>
        </div>
      </div>
      </form>
    </div>
  </div>
{/block}

{block name="script"}
<script type="text/javascript">
layui.use(['layer', 'form'], function(){
  var layer = layui.layer
  ,form = layui.form;
  
  //自定义验证规则
  form.verify({
    oldpassword: function(value){
      if(value.length < 1){
        return '请输入您的原密码';
      }
    }
    ,password: function(value){
      if(value.length < 1){
        return '请输入您的新密码';
      }
    }
    ,repassword: function(value){
      if(value.length < 1){
        return '请确认您的新密码';
      }
    }
  });

    //监听提交
  form.on('submit(sub)', function(data){
      // console.log(data.field);
      // return false;
    $.post('/home/member.index/pass', data.field, function(d){
      // console.log(d);
      // return false;
      if(d.code == 1){
        layer.msg(d.msg, {icon:1});
        window.location.href = d.url;
      }else{
        layer.msg(d.msg, {icon:5});
      }
    });
    return false;
  });
});
</script>

{/block}